<%@ page import="com.ws.utils.Res" %><%--
  Created by IntelliJ IDEA.
  User: lufei
  Date: 2025/3/22
  Time: 10:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java"  isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="${ pageContext.request.contextPath}/admin/bootstrap/css/bootstrap.min.css">
	<script src="${ pageContext.request.contextPath}/admin/bootstrap/js/jquery-2.1.0.min.js"></script>
	<script src="${ pageContext.request.contextPath}/admin/bootstrap/js/bootstrap.min.js"></script>
    <style>

       .cus-container{
           width: 1368px;
           margin: 50px auto;
       }
       #user-add .modal-content{
       	padding: 0 20px 20px;	
       }
       #user-edit .modal-content{
       	padding: 0 20px 20px;	
       }
       
    </style>
</head>
<body>

<div class="cus-container">
        <h2 style="text-align: center;color: #1b6d85">
            供应商管理
        </h2>
    <div>
        <div id="search-friendlink" style="float: left; margin: 10px 0px;">
            <form class="form-inline" action="${pageContext.request.contextPath}/supplier/list" method="post">
                <div class="form-group">
                    <label for="exampleInputName2">供应商名称</label>
                    <input type="text" name="supplier_name" value="${supplierVo.supplier_name}" class="form-control" id="exampleInputName2" >
                </div>
                <div class="form-group">
                    <label for="exampleInputName1">联系方式</label>
                    <input type="text" name="contactInfo" value="${supplierVo.contactInfo}" class="form-control" id="exampleInputName1" >
                </div>
                <button type="submit" class="btn btn-default">查询</button>
            </form>
        </div>
        <div style="float: right;margin: 10px 0px;">
            <a class="btn btn-primary" href="${ pageContext.request.contextPath}/supplier/toAdd">添加供应商</a>
        </div>
    </div>

       <table class="table table-bordered clearfix" id="friendlink-list">
        <thead>
        	<tr class="bg-primary">
	            <th>编号</th>
                <th>供应商名称</th>
                <th>供应商地址</th>
                <th>联系方式</th>
                <th>操作</th>
	        </tr> 
        </thead> 
        <tbody>
        <c:forEach items="${pageInfo.list}" var="supplier">
            <tr>
                <td>${supplier.supplier_id}</td>
                <td>${supplier.supplier_name}</td>
                <td>${supplier.supplier_address}</td>
                <td>${supplier.contactInfo}</td>
                <td>
                    <a href="${ pageContext.request.contextPath}/supplier/toupdate?id=${supplier.supplier_id}">修改</a>
                    <a href="${ pageContext.request.contextPath}/supplier/delete?id=${supplier.supplier_id}">删除</a>
                </td>
            </tr>
        </c:forEach>
         </tbody>
      </table>
    <div class="text-center">
        <ul class="pagination">
            <li><a href="${ pageContext.request.contextPath}/supplier/list?currentPage=1&supplier_name=${supplierVo.supplier_name}&pageSize=${ pageInfo.pageSize}">首页</a></li>
            <li><a href="${ pageContext.request.contextPath}/supplier/list?currentPage=${ pageInfo.prePage}&supplier_name=${supplierVo.supplier_name}&pageSize=${ pageInfo.pageSize}">上一页</a></li>
            <c:forEach begin="${ pageInfo.navigateFirstPage}" end="${ pageInfo.navigateLastPage}" var="page">
                <li><a href="${ pageContext.request.contextPath}/supplier/list?currentPage=${ page}&supplier_name=${supplierVo.supplier_name}&pageSize=${ pageInfo.pageSize}">${ page}</a></li>
            </c:forEach>
            <li><a href="${ pageContext.request.contextPath}/supplier/list?currentPage=${ pageInfo.nextPage}&supplier_name=${supplierVo.supplier_name}&pageSize=${ pageInfo.pageSize}">下一页</a></li>
            <li><a href="${ pageContext.request.contextPath}/supplier/list?currentPage=${ pageInfo.pages}&supplier_name=${supplierVo.supplier_name}&pageSize=${ pageInfo.pageSize}">末页</a></li>
            <li><a>当前第${ pageInfo.pageNum}页</a></li>
            <li><a>共${ pageInfo.pages}页</a></li>
            <li><a>共${ pageInfo.total}条记录</a></li>
            <li>
                <a>
                    每页显示：
                    <select name="pageSize" onchange="sel(this.value)">
                        <option value="2" ${pageInfo.pageSize == 2 ? 'selected' : ''}>2</option>
                        <option value="5" ${pageInfo.pageSize == 5 ? 'selected' : ''}>5</option>
                        <option value="10" ${pageInfo.pageSize == 10 ? 'selected' : ''}>10</option>
                    </select>条
                </a>
            </li>
        </ul>
    </div>

 </div>
</body>
</html>
<script>
    function sel(pageSize) {
        location.href = "${ pageContext.request.contextPath}/supplier/list?currentPage=1&supplier_name=${supplierVo.supplier_name}&pageSize="+pageSize;
    }
</script>